package com.sensePlusVR.utils;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

public class BtimapFile {
	static private String TAG=BtimapFile.class.getSimpleName();
	static public Bitmap getBitmapFromFile(String filePath) {
		Bitmap bitmap = null;
		try {
			if (filePath != null) {
				FileInputStream fis = new FileInputStream(filePath);
				bitmap = BitmapFactory.decodeStream(fis);
			}
		} catch (FileNotFoundException e) {
			MyLog.e(TAG, "getBitmapFromFile exception : " + e.getMessage());
			bitmap = null;
		}
		return bitmap;
	}
	
	static public Bitmap getBitmapFromFile(File file) {
		Bitmap bitmap = null;
		try {
			if (file != null) {
				FileInputStream fis = new FileInputStream(file);
				bitmap = BitmapFactory.decodeStream(fis);
			}
		} catch (FileNotFoundException e) {
			MyLog.e(TAG, "getBitmapFromFile exception : " + e.getMessage());
			bitmap = null;
		}
		return bitmap;
	}
}
